package com.ac.api.user.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ac.api.user.entity.AcUser;
import com.ac.api.user.vo.AcUserVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author mzl
 * @since 2020-07-09
 */
public interface AcUserMapper extends BaseMapper<AcUser> {
    /**
     * 根据账号获取用户信息
     *
     * @param username
     * @return
     */
    AcUserVo getMemberByAccount(@Param("username")String username);
    /**
     * 根据openid获取用户信息
     *
     * @param thirdType,thirdId
     * @return
     */
    AcUserVo getMemberByThirdId(@Param("thirdType")String thirdType, @Param("thirdId")String thirdId);

    /**
     * 根据账号获取用户信息
     *
     * @param username
     * @return
     */
    AcUser findByUsername(@Param("username") String username);

    /**
     * 条件查询
     *
     * @return
     */
    IPage<AcUserVo> findByExample(@Param("ex")AcUserVo example, Page page);
    /**
     *List<AcUserVo> findByExample(@Param("ew") Wrapper<AcUserVo> wrapper, @Param("page") Page<AcUserVo> page);
     */
    IPage<AcUserVo> findByGroupid( Integer groupid,Page page);
    /**
     * 根据重置令牌获取对象
     *
     * @param resettoken
     * @return
     */
    AcUser findByResettoken(@Param("resettoken") String resettoken);

    /**
     * 角色id和部门id
     * @param acGroup
     * @param departmentId
     * @return
     */
    List<AcUser> selectByAcGroupAndDepartmentId(@Param("acGroup")Integer acGroup, @Param("departmentId")Integer departmentId);

    AcUser findByUserphone(String phone);

    AcUser findByThirdId(String thirdId);
}
